package com.ouwen.smartpay.exception;

import com.fm.core.utils.enums.Messageable;

/**
 *@author <a href="http://youngitman.tech">青年IT男</a>
 *@version v1.0.0
 *@className OpenApiException
 *@description
 *@JunitTest: {@link  } 
 *@date 2020-04-23 13:42    
 *
 *
**/
public class DatagramSlotException extends RuntimeException implements Messageable {

    private String code = "OPENAPI";

    public DatagramSlotException() {
        super();
    }

    public DatagramSlotException(String message) {
        super(message);
    }

    /**
     * @param message 错误消息
     * @param writableStackTrace 是否收集线程栈信息，对于业务明确的异常，请关闭,设置为false为关闭
     */
    public DatagramSlotException(String message, boolean writableStackTrace) {
        super(message, null, false, writableStackTrace);
    }

    /**
     * @param message 错误消息
     * @param writableStackTrace 是否收集线程栈信息，对于业务明确的异常，请关闭,设置为false为关闭
     */
    public DatagramSlotException(String message, String code, boolean writableStackTrace) {
        super(message, null, false, writableStackTrace);
        this.code = code;
    }

    public DatagramSlotException(String message, Throwable cause) {
        super(message, cause);
    }

    public DatagramSlotException(Throwable cause) {
        super(cause);
    }

    public DatagramSlotException(String message, String code) {
        super(message);
        this.code = code;
    }

    public DatagramSlotException(String message, Throwable cause, String code) {
        super(message, cause);
        this.code = code;
    }

    public DatagramSlotException(Throwable cause, String code) {
        super(cause);
        this.code = code;
    }

    public DatagramSlotException(Messageable messageable) {
        super(messageable.message());
        this.code = messageable.code();
    }

    public DatagramSlotException(Messageable messageable, String msg) {
        super(msg);
        this.code = messageable.code();
    }

    public DatagramSlotException(Messageable messageable, Throwable cause) {
        super(messageable.message(), cause);
        this.code = messageable.code();
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String code() {
        return this.code;
    }

    @Override
    public String message() {
        return this.getMessage();
    }
}
